home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Graphics / source / ray_3d.cp < prev    next >
Encoding:
Text File  |  1995-03-25  |  1.4 KB  |  29 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    ray.cp
  3. //    Date:                    9/22/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the class methods for a ray
  7. //
  8. //------------------------------------------------------------------------------
  9.  
  10. #include "ray_3d.h"
  11.  
  12. //------------------------------------------------------------------------------
  13. //    constructor
  14. //------------------------------------------------------------------------------
  15. ray::ray (const point_3d &orig, const vector_3d &dir)                                                        //    constructor
  16. {                                                                                                                                                                //    begin
  17.     origin = orig; direction = dir;                                                                                                //    copy the parameters
  18.     direction.Normalize ();                                                                                                                //    make sure the direction vector_3d has length 1
  19. }                                                                                                                                                                //    end
  20.  
  21. //------------------------------------------------------------------------------
  22. //    compute the intersection point_3d
  23. //------------------------------------------------------------------------------
  24. point_3d        ray::IntersectionPoint (real distance) const                                                //    compute the point_3d at which the intersection occurs
  25. {                                                                                                                                                                //    begin
  26.     return origin + (direction * distance);                                                                                //    return the point_3d
  27. }                                                                                                                                                                //    end
  28. //------------------------------------------------------------------------------
  29.